import os
import sys

def create_time_tex(times):
    raw_data = open(times).read().strip()
    filas = [r.strip().split(',') for r in raw_data.split('\n')]
    pipes = "{|%s|}" % ("|".join(["l"] * len(filas[0])),)
    data = []
    for columnas in filas:
        cs = " & ".join(columnas) + " \\\\\n\\hline\n"
        data.append(cs)

    data = "".join(data)
    res = """
    \\begin{table}
        \\caption{Tiempos de resolucion de los tableros segun algoritmo}
        \\begin{center}
        \\begin{tabular}%(pipes)s
\\hline
%(data)s
        \\end{tabular}
        \\end{center}
    \\end{table}
    """
    return res % locals()



if __name__ == '__main__':
    res = create_time_tex(sys.argv[1])
    print res
